package com.trade.wzj.service.yang.impl;

import java.util.List;

import com.trade.wzj.dao.yang.ClientInfoDao_Yang;
import com.trade.wzj.model.xiang.ClientInfo;
import com.trade.wzj.service.yang.ClientInfoService_Yang;

public class ClientInfoImpl_Yang implements ClientInfoService_Yang {
	
	
	private ClientInfoDao_Yang clientInfoDao;

	public ClientInfoDao_Yang getClientInfoDao() {
		return clientInfoDao;
	}

	public void setClientInfoDao(ClientInfoDao_Yang clientInfoDao) {
		this.clientInfoDao = clientInfoDao;
	}


	@Override
	public List<ClientInfo> clientMhSel(String name)throws Exception{
		List<ClientInfo> list=null;
		try {
			list=clientInfoDao.clientMhSel(name);
		} catch (Exception e) {
			throw new Exception();
		}
		return list;
	}

	//通过id查询客户基本信息
	@Override
	public ClientInfo getClientInfoById(Integer id) throws Exception {
		ClientInfo cli =null;
		String msg="";
		try {
			if(null!=id) {
				cli=clientInfoDao.getClientInfoById(id);
			}else {
				msg="id为空，查询失败";
				throw new Exception(msg);
			}
		} catch (Exception e) {
			msg="查询失败!";
			throw new Exception(msg);
		}
		return cli;
	}

	//通过id修改客户基本信息
	@Override
	public void updateClientInfoById(ClientInfo client) throws Exception {
		try {
			if(null!=client.getClientInfoID()) {
				clientInfoDao.updateClientInfoById(client);
			}else {
				throw new Exception("id为空，修改失败");
			}
		} catch (Exception e) {
			throw new Exception("修改失败!");
		}
		
	}

}
